<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual describes GNU Stow version 2.3.1
(28 July 2019), a program for managing farms of symbolic links.

Software and documentation is copyrighted by the following:

(C) 1993, 1994, 1995, 1996 Bob Glickstein <bobg+stow@zanshin.com>


(C) 2000, 2001 Guillaume Morin <gmorin@gnu.org>


(C) 2007 Kahlil (Kal) Hodgson <kahlil@internode.on.net>


(C) 2011 Adam Spiers <stow@adamspiers.org>

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.


Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled "GNU General Public License" is included with the
modified manual, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the Free Software Foundation. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Deleting Packages (Stow)</title>

<meta name="description" content="Deleting Packages (Stow)">
<meta name="keywords" content="Deleting Packages (Stow)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index.html#Index" rel="index" title="Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Conflicts.html#Conflicts" rel="next" title="Conflicts">
<link href="Installing-Packages.html#Installing-Packages" rel="prev" title="Installing Packages">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<a name="Deleting-Packages"></a>
<div class="header">
<p>
Next: <a href="Conflicts.html#Conflicts" accesskey="n" rel="next">Conflicts</a>, Previous: <a href="Installing-Packages.html#Installing-Packages" accesskey="p" rel="prev">Installing Packages</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Deleting-Packages-1"></a>
<h2 class="chapter">6 Deleting Packages</h2>

<a name="index-deletion"></a>
<p>When the <samp>-D</samp> option is given, the action of Stow is to
delete a package from the target tree.  Note that Stow will not
delete anything it doesn&rsquo;t &ldquo;own&rdquo;.  Deleting a package does <em>not</em>
mean removing it from the stow directory or discarding the package
tree.
</p>
<p>To delete a package, Stow recursively scans the target tree, skipping over any
directory that is not included in the installation image.<a name="DOCF7" href="#FOOT7"><sup>7</sup></a>
For example, if the target directory is <samp>/usr/local</samp> and the
installation image for the package being deleted has only a <samp>bin</samp>
directory and a <samp>man</samp> directory at the top level, then we only scan
<samp>/usr/local/bin</samp> and  <samp>/usr/local/man</samp>, and not
<samp>/usr/local/lib</samp> or <samp>/usr/local/share</samp>, or for that matter
<samp>/usr/local/stow</samp>.  Any symlink it finds that points into the package
being deleted is removed.  Any directory that contained only symlinks to the
package being deleted is removed.
</p>
<a name="tree-refolding"></a><a name="Refolding-_0060_0060foldable_0027_0027-trees_002e"></a>
<h3 class="section">6.1 Refolding &ldquo;foldable&rdquo; trees.</h3>
<a name="index-refolding-trees"></a>
<a name="index-tree-refolding"></a>

<p>After removing symlinks and empty subdirectories, any directory that
contains only symlinks to a single other package is considered to be a
previously &ldquo;folded&rdquo; tree that was &ldquo;split open.&rdquo;  Stow will refold
the tree by removing the symlinks to the surviving package, removing
the directory, then linking the directory back to the surviving
package.  However, this behaviour can be prevented via the
<samp>--no-folding</samp> option; see <a href="Invoking-Stow.html#Invoking-Stow">Invoking Stow</a>.
</p>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>

<h3><a name="FOOT7" href="#DOCF7">(7)</a></h3>
<p>This
approach was introduced in version 2 of GNU Stow.  Previously, the whole
target tree was scanned and stow directories were explicitly omitted.  This
became problematic when dealing with very large installations.  The only
situation where this is useful is if you accidentally delete a directory in
the package tree, leaving you with a whole bunch of dangling links.  Note that
you can enable the old approach with the <samp>-p</samp> option.  Alternatively, you can
use the <samp>--badlinks</samp> option get stow to search for dangling links in your target tree and remove the offenders manually.</p>
</div>



</body>
</html>
